package com.hs.hlw.credit.system.business.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * RegularExpressionDto
 * @author zhb
 * @date 2018/11/20
 */
public class RegularExpressionDto {
    @Data
    public static class Add {
        @NotBlank(message = "名称未填写")
        @Length(max = 20, message = "名称长度不能超过20个字符")
        private String name;
        @NotBlank(message = "脚本内容未填写")
        @Length(max = 100, message = "脚本内容长度不能超过100个字符")
        private String content;
        @NotBlank(message = "错误提示未填写")
        @Length(max = 100, message = "错误提示长度不能超过100个字符")
        private String errorMsg;
        @NotNull(message = "未指定状态")
        @Range(min = 0, max = 1, message = "指定状态无效")
        private Short status;
        @Length(max = 200, message = "备注长度不能超过200个字符")
        private String remark;
    }

    @Data
    public static class Update {
        @NotNull(message = "未指定要修改的记录")
        private Integer id;
        @NotBlank(message = "名称未填写")
        @Length(max = 20, message = "名称长度不能超过20个字符")
        private String name;
        @NotBlank(message = "脚本内容未填写")
        @Length(max = 100, message = "脚本内容长度不能超过100个字符")
        private String content;
        @NotBlank(message = "错误提示未填写")
        @Length(max = 100, message = "错误提示长度不能超过100个字符")
        private String errorMsg;
        @NotNull(message = "未指定状态")
        @Range(min = 0, max = 1, message = "指定状态无效")
        private Short status;
        @Length(max = 200, message = "备注长度不能超过200个字符")
        private String remark;
    }

    @Data
    public static class BatchUpdateStatus {
        @NotNull(message = "未指定状态")
        @Range(min = 0, max = 1, message = "指定状态有误")
        private Short status;
        @NotEmpty(message = "未指定表达式")
        private List<RegularExpressionDto.RegularExpression> expressionList;
    }

    @Data
    public static class RegularExpression {
        private Integer id;
    }
}